Syntactic Type Polymorphism for Recursive Function De nitions

نویسندگان

  • Jean-Pierre Talpin
  • Yan-Mei Tang
چکیده

Higher-order programming languages, such as ML, permit a exible programming style by using compile-time type inference together with the concept of type polymorphism, which allows to specify the types of generic functions. In ML, however, recursive functions must always be given a unique (monomorphic) type inside their deenition. Giving polymorphic types to recursive functions is known as the problem of polymorphic recursion which has been shown equivalent to the problem of semi-uniication, known as undecidable. We show that the absence of a decidable speciication to give polymorphic types for recursive deeni-tions lies on the non-adequacy of representing type polymorphism by using type variables as primitive elements. We introduce the notion of syntactic type polymorphism to relate polymorphic types with syntactic information. We formulate a decidable calculus which gives polymorphic types to recursive functions in ML. We present an inference algorithm which we prove the termination and correctness.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Inductive Data Type Systems: Strong Normalization

This paper is concerned with the foundations of Inductive Data Type Systems, an extension of pure type systems by inductive data types. IDTS generalize (inductive) types equipped with primitive recursion of higher-type, by providing de nitions of functions by pattern matching of a form which is general enough to capture recursor de nitions for strictly positive inductive types. IDTS also genera...

متن کامل

Rank 2 Type Systems and Recursive Deenitions Technical Memorandum Mittlcsstmm531

We demonstrate an equivalence between the rank 2 fragments of the polymorphic lambda calculus (System F) and the intersection type discipline: exactly the same terms are typable in each system. An immediate consequence is that typability in the rank 2 intersection system is DEXPTIME-complete. We introduce a rank 2 system combining intersections and polymorphism, and prove that it types exactly ...

متن کامل

Programming Examples Needing Polymorphic Recursion

Inferring types for polymorphic recursive function de nitions (abbreviated to polymorphic recursion) is a recurring topic on the mailing lists of popular typed programming languages. This is despite the fact that type inference for polymorphic recursion using 8-types has been proved undecidable. This report presents several programming examples involving polymorphic recursion and determines the...

متن کامل

Step-Indexed Syntactic Logical Relations for Recursive and Quantified Types

We present a proof technique, based on syntactic logical relations, for showing contextual equivalence of expressions in a λ-calculus with recursive types and impredicative universal and existential types. We show that for recursive and polymorphic types, the method is both sound and complete with respect to contextual equivalence, while for existential types, it is sound but incomplete. Our de...

متن کامل

Polymorphic Type Inference and Semi-Uni cation

In the last ten years declaration-free programming languages with a polymorphic typing discipline (ML, B) have been developed to approximate the exibility and conciseness of dynamically typed languages (LISP, SETL) while retaining the safety and execution e ciency of conventional statically typed languages (Algol68, Pascal). These polymorphic languages can be type checked at compile time, yet a...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1994